# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Jameson Pugh <imntreal@gmail.com>
# Contributor: Tim Jester-Pfadt <t.jp<at>gmx.de>

pkgbase=appstream
pkgname=(appstream appstream-qt)
pkgver=0.14.5
pkgrel=2
pkgdesc='Provides a standard for creating app stores across distributions'
arch=(x86_64)
url='https://distributions.freedesktop.org/wiki/AppStream'
license=(GPL)
depends=(curl librsvg libyaml libstemmer lmdb libsoup)
makedepends=(meson xmlto gobject-introspection gtk-doc qt5-tools itstool vala gperf)
source=(https://www.freedesktop.org/software/appstream/releases/AppStream-$pkgver.tar.xz{,.asc}
        update-appstream-cache.hook)
sha256sums=('0bc1db19608141b090cb25d004fab2bb3b3ee8b2716de8bac162fefebe9a5ad1'
            'SKIP'
            '3a96a1479cfd18dad36c2ca3181aabe46af9bf772c00b965d86ec5f55cd0e0eb')
validpgpkeys=(D33A3F0CA16B0ACC51A60738494C8A5FBF4DECEB) # Matthias Klumpp <matthias@tenstral.net>

build() {
  meson build AppStream-$pkgver \
    --prefix=/usr \
    --libexecdir=lib \
    -Dqt=true \
    -Dvapi=true \
    -Dcompose=true
  meson compile -C build
}

package_appstream() {
  meson install --destdir "$pkgdir" -C build

# provided by -qt subpackage
  rm -r "$pkgdir"/usr/{include/AppStreamQt,lib/cmake,lib/libAppStreamQt.*}

  install -Dm644 update-appstream-cache.hook "$pkgdir"/usr/share/libalpm/hooks/update-appstream-cache.hook
}

package_appstream-qt() {
  pkgdesc='Qt5 interface for AppStream'
  depends=(appstream qt5-base)

  meson install --destdir "$pkgdir" -C build

# provided by appstream
  rm -r "$pkgdir"{/etc,/usr/{bin,include/appstream{,-compose},lib/{appstreamcli-compose,girepository-1.0,libappstream*,pkgconfig},share}}
}
